# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=libpwquality
pkgver=1.4.4
pkgrel=3
pkgdesc="Password quality checking library"
url="https://github.com/libpwquality/libpwquality"
arch="all"
license="BSD-3-Clause"
depends="cracklib-words"
makedepends="cracklib-dev python3-dev linux-pam-dev"
options="!check" # no tests
subpackages="$pkgname-static $pkgname-dev $pkgname-doc py3-$pkgname:_py3 $pkgname-lang"
source="https://github.com/libpwquality/libpwquality/releases/download/libpwquality-$pkgver/libpwquality-$pkgver.tar.bz2
	0001-fix-musl-build.patch
	"

build() {
	LDFLAGS="$LDFLAGS -lintl" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-python-bindings \
		--with-python-binary=python3 \
		--enable-pam \
		--with-securedir=/lib/security
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

_py3() {
	pkgdesc="$pkgdesc - Python3 bindings"
	depends="$pkgname=$pkgver-r$pkgrel python3"

	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
}

sha512sums="2d49b79105361663f009f7183fde9123e6f1e63bd678dfe5418143f611e763af8dd44374b826b3c22a00e721047c539741dc44d99a2289b9ab229791768d6e76  libpwquality-1.4.4.tar.bz2
c0b01bbb798a13b706668bdad028334ca6b4bb384dee5d6aefabbd0f4c1946c7e73e50197ced65c959655623570660ed06ef760599e02b770f1d4e4042117912  0001-fix-musl-build.patch"
